<template>
  <a-menu mode="inline" :style="{ width: '200px' }" :default-selected-keys="[]" @click="$emit('select')">
    <template v-for="item of data">
      <Sub v-if="item.children" :item="item" :key="item.id" />
      <a-menu-item v-else :key="item.id"><span>{{item.title}}</span></a-menu-item>
    </template>
  </a-menu>
</template>

<script>
import Sub from './Sub.vue'

export default ({
  name: 'Menu',
  components: { Sub },
  props: {
    data: { type: Array, default: () => [] }
  }
})
</script>

<style scoped lang='stylus'>

</style>
